Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(responses): Add ability to return eventual response body from hooks #100

Closed
wants to merge 5 commits into from

Conversation

MLBMatt
Copy link

@MLBMatt MLBMatt commented Nov 5, 2019

This comes from a need to support response bodies from hooks to drive Tekton Pipelines (https://github.com/tektoncd/pipeline). Tekton is a "new" (formally the Knative project) CI job runner that is k8s-native. Tekton runs k8s Jobs in-cluster to run various build stages.

In order to trigger a build initially however, you can do it manually through the Tekton dashboard or through their Triggers (https://github.com/tektoncd/triggers) project. Triggers bind webhook endpoints to Pipelines and allow a more closed-loop CI process. This Triggers project is still very new and has limited support for manipulating the webhook request payload (in this instance, a Github event).

Triggers do have this concept of "Interceptors" which essentially act as proxies from a webhook, through a custom k8s service (in our instance just an express server using the @octokit/webhooks.js lib) and back to the Tekton Pipeline to initiate a run. To this end, the Interceptor needs to be able to return a response body to the Pipeline in order for the Pipeline to know various things like commit hash, ref, repo name, clone url, etc.

Currently, the webhooks.js lib does not allow hooks to return data to/as the response body. This PR allows 1-n hooks to return objects that are later merged into a resulting response body which can then be utilized by the originator (or proxy in our case).

See #99 for the original ask.

@MLBMatt MLBMatt changed the title feat(responses) Add ability to return eventual response body from hooks feat(responses): Add ability to return eventual response body from hooks Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant